package normalapi;

import java.io.IOException;

public class RunTimeDemo {
    public static void main(String[] args) throws IOException {
        Runtime runtime = Runtime.getRuntime();
        Runtime runtime2 = Runtime.getRuntime();
//        System.out.println(runtime == runtime2);//true
        System.out.println(runtime.availableProcessors());//获取CPU的线程数
        System.out.println(runtime.freeMemory());// 获取空闲内存
        System.out.println(runtime.totalMemory() / 1024 / 1024);//获取总内存
        //运行 cmd 命令
//        runtime.exec("calc.exe");
    }
}
